package com.xbongbong.saas.enums.mini;

import lombok.Getter;
import lombok.ToString;

/**
 * 应用模块名称<p>
 * 代码描述<p>
 * Company: 逍邦网络科技有限公司<p>
 *
 * @author chenshan
 * @version v1.0
 * @since 2020/9/3 1:41 下午
 */
@Getter
@ToString
public enum DingBundleTypeEnum {
    /**
     * 群类型,1:销售群,2:客户群,3:酷应用;等等后续可拓展
     */

    SALES_GROUP(1,"销售群"),
    CUSTOMER_GROUP(2,"客户群"),
    COOL_APP(3,"酷应用群"),

    /**
     * 未知规则,当异常时用于返回
     */
    UNKNOWN(404, "");
    ;

    private final Integer code;

    private final String name;

    DingBundleTypeEnum(Integer code, String name){
        this.code= code;
        this.name= name;
    }
    
    public static DingBundleTypeEnum getByCode(Integer code) {
        for ( DingBundleTypeEnum cacheCode : values()) {
            if (cacheCode.getCode().equals(code)) {
                return cacheCode;
            }
        }
        return UNKNOWN;
    }
    
}
